home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 350 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.8 KB

  1. Path: chronicle.mti.sgi.com!auster
  2. From: esap@cs.tut.fi (Pulkkinen Esa)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Observations on templates
  5. Date: 12 Feb 1996 10:16:10 PST
  6. Organization: Tampere University of Technology
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4fiv5e$fda@peippo.cs.tut.fi>
  9. References: <ACVI83na99@qsar.chem.msu.su> <4fa6d0$115g@news.gate.net>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 10 Feb 1996 20:28:30 GMT
  12. Nntp-Posting-User: esap
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMR+D/0y4NqrwXLNJAQEuqgH9HSED3NeTyvJ51oxSYE6QSl2bIXjoye8Y
  15.     Lmg1VfQDCHfIX+TyvwuaZzWpJzWc55wPU9Aww7Dj5HJY5zVSi8+u2g==
  16.     =NxVr
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. In article <4fa6d0$115g@news.gate.net>, Ken Walter <solution@gate.net> wrote:
  20. >template <class T, class S> T cast_d( S s) { return dynamic_cast<T>s; }
  21.  
  22. >Casts could almost be implemented without being part of the language.
  23. >
  24. They can. But it's too much work for the programmer to do it. I've used
  25. a simulation of a dynamic_cast when I didn't have a compiler that supports
  26. them. The problem with such a simulation is that you have to provide
  27. most of the information dynamic_cast uses by yourself (for the second time), 
  28. even though you have already provided the compiler with the same
  29. information in the class declaration. Or you can use macro hackery
  30. to do that for you, but that's ugly.
  31. -- 
  32.    Esa Pulkkinen                        | C++ programmers do it virtually
  33.    E-Mail:  esap@cs.tut.fi              | everywhere with a class, resulting
  34.    WWW   :  http://www.cs.tut.fi/~esap/ | in multiple inheritance.
  35. ---
  36. [ comp.std.c++ is moderated.  Submission address: std-c++@ncar.ucar.edu.
  37.   Contact address: std-c++-request@ncar.ucar.edu.  The moderation policy is
  38.   in http://reality.sgi.com/employees/austern_mti/std-c++/policy.html. ]
  39.